package ch01.a13;

/**
 * @description: 简单的java计算器实现
 * @author: Fesine
 * @createTime:2016/7/13 13:46
 * @update:修改内容
 * @author: Fesine
 * @updateTime:2016/7/13 13:46
 */
public class Program {

    public static void operMethod(String strNumA, String strNumB, char oper) {
        try {

            int a = Integer.parseInt(strNumA);
            int b = Integer.parseInt(strNumB);
            String result;
            switch (oper) {
                case '+':
                    result = a + b + "";
                    break;
                case '-':
                    result = a - b + "";
                    break;
                case '*':
                    result = a * b + "";
                    break;
                case '/':
                    if (b == 0) {
                        result = "除数不能为0";
                    } else {
                        result = a / b + "";
                    }
                    break;
                default:
                    result = "";
            }
            System.out.println("结果是：" + result);
        } catch (Exception e) {
            System.out.println("您的输入有误！");
        }

    }

    public static void main(String[] args) {
        operMethod("10","3",'/');
    }


}
